package com.erp.erp_servers.Contract_Info.Imp;

import com.erp.erp_dao.Contract_Info.ContractInfoexDao;
import com.erp.erp_entitys.Contract_Info.ContractInfoex;
import com.erp.erp_servers.Contract_Info.ContractInfoexService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;

/**
 * 合同主信息扩展表(ContractInfoex)表服务实现类
 *
 * @author makejava
 * @since 2020-10-11 18:53:05
 */
@Transactional(readOnly = true)
@Service("contractInfoexService")
public class ContractInfoexServiceImpl implements ContractInfoexService {
    @Resource
    private ContractInfoexDao contractInfoexDao;

    /**
     * 通过ID查询单条数据
     *
     * @return 实例对象
     */
    @Override
    public ContractInfoex queryById(Long id) {
        return this.contractInfoexDao.queryById(id);
    }

    /**
     * 新增数据
     *
     * @param contractInfoex 实例对象
     * @return 实例对象
     */
    @Override
    public ContractInfoex insert(ContractInfoex contractInfoex) {
        this.contractInfoexDao.insert(contractInfoex);
        return contractInfoex;
    }

    /**
     * 修改数据
     *
     * @param contractInfoex 实例对象
     * @return 实例对象
     */
    @Override
    public ContractInfoex update(ContractInfoex contractInfoex) {
        this.contractInfoexDao.update(contractInfoex);
        return this.queryById(contractInfoex.getContractid());
    }

    /**
     * 通过主键删除数据
     *
     * @param
     * @return 是否成功
     */
    @Override
    public boolean deleteById(Long id) {
        return this.contractInfoexDao.deleteById(id) > 0;
    }
}